import time
from selenium import webdriver
from selenium.webdriver.common.by import By

class shop:
    def __init__(self):
        self.driver = webdriver.Chrome()
        self.driver.get('https://ecshop.test2.shopex123.com/')
        time.sleep(2)
    def register(self):
        self.driver.find_element(By.XPATH,'//a[contains(text(),"注册") and @class="reg"]').click()
        time.sleep(1)
    def fillin(self):
        self.driver.find_element(By.XPATH,'//input[@id="username"]').send_keys('pp668')
        self.driver.find_element(By.XPATH,'//input[@id="email"]').send_keys('7@qq.com')
        self.driver.find_element(By.XPATH,'//input[@id="password1"]').send_keys('qweasdzxc')
        self.driver.find_element(By.XPATH,'//input[@id="confirm_password"]').send_keys('qweasdzxc')
    def confirm(self):
        self.driver.find_element(By.XPATH,'//input[@name="Submit" and @type="submit"]').click()
        time.sleep(2)
    def login(self):
        self.driver.find_element(By.XPATH,'//a[contains(text(),"立即登录")]').click()
        self.driver.find_element(By.XPATH,'//input[@class="inputborder" and @name="username"]').clear()
        self.driver.find_element(By.XPATH,'//input[@class="inputborder" and @name="username"]').send_keys('pp668')
        self.driver.find_element(By.XPATH,'//input[@class="inputborder" and @name="password"]').clear()
        self.driver.find_element(By.XPATH,'//input[@class="inputborder" and @name="password"]').send_keys('qweasdzxc')
        self.driver.find_element(By.XPATH,'//input[@type="submit"]').click()
        time.sleep(2)

case = shop()
case.register()
case.login()







